package com.example.SBootDemo.model.function;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
@Table(name="user")
public class user {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int id;
	private String truename;
	private String username;
	private String password;
	private String dept;
	private String position;
	private String sex;
	//附加表--用来扩充用户信息
	@OneToOne(fetch = FetchType.EAGER) 
	@JoinColumn(name = "other_id")
	private otherinfo other;
	
	  @OneToOne(fetch = FetchType.EAGER)   
	  
	  @JoinColumn(name = "role_id")
	private  role role;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getTruename() {
		return truename;
	}

	public void setTruename(String truename) {
		this.truename = truename;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getDept() {
		return dept;
	}

	public void setDept(String dept) {
		this.dept = dept;
	}

	public String getPosition() {
		return position;
	}

	public void setPosition(String position) {
		this.position = position;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public role getRole() {
		return role;
	}

	public void setRole(role role) {
		this.role = role;
	}

	public user(int id, String truename, String username, String password, String dept, String position, String sex,
			com.example.SBootDemo.model.function.role role) {
		super();
		this.id = id;
		this.truename = truename;
		this.username = username;
		this.password = password;
		this.dept = dept;
		this.position = position;
		this.sex = sex;
		this.role = role;
	}
	
	
	public user() {

	}

	@Override
	public String toString() {
		return "user [id=" + id + ", truename=" + truename + ", username=" + username + ", password=" + password
				+ ", dept=" + dept + ", position=" + position + ", sex=" + sex + ", other=" + other + ", role=" + role
				+ "]";
	}
	  
	  
}
